package com.tutos.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.ForeignKey;


@Entity
@PrimaryKeyJoinColumn(name="id")
@NamedQueries({
	@NamedQuery(name="getAllEstudiantes", query="SELECT e FROM Estudiante e"),
	@NamedQuery(name="getEstudianteByCorreo", query="SELECT e FROM Estudiante e WHERE e.correo=:correo")
})

public class Estudiante extends Persona{
	
	private static final long serialVersionUID = 1L;
	
	@OneToMany(mappedBy = "estudiante")
	private List<CalificacionesEstudiante> calificaciones;
	
	public List<CalificacionesEstudiante> getCalificaciones() {
		return calificaciones;
	}
	public void setCalificaciones(List<CalificacionesEstudiante> calificaciones) {
		this.calificaciones = calificaciones;
	}
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "monitor_estudiante", joinColumns = @JoinColumn(name = "monitor"), inverseJoinColumns = @JoinColumn(name = "estudiante"), uniqueConstraints = @UniqueConstraint(columnNames = {
			"monitor", "estudiante" }))
	private List<Monitor> monitores;
	
	public List<Monitor> getMonitores() {
		return monitores;
	}
	public void setMonitores(List<Monitor> monitores) {
		this.monitores = monitores;
	}
	
}
